package com.runshu.newsmartark.mvp.presenter;

import com.runshu.newsmartark.mvp.contract.ProductTypeDtaContract;
import com.runshu.newsmartark.network.netbean.ResponseBean;
import com.runshu.newsmartark.network.netinterface.MyCallBack;

/**
 * Demo class
 *
 * @author yu
 * @date 2020/11/2
 * @decs：
 */

public class ProductTypeDtaPresenter implements ProductTypeDtaContract.Presenter {
    private ProductTypeDtaContract.View view;
    private ProductTypeDtaContract.Model model;

    public ProductTypeDtaPresenter(ProductTypeDtaContract.View view, ProductTypeDtaContract.Model model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void getCategoryList(String macAddress,int type) {
        model.getCategoryList(macAddress, type,new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.onGetCategoryListSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });

    }

    @Override
    public void getStockSel(String macAddress, int type) {
        model.getStockSel(macAddress, type,new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.onGetStockSelSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });
    }

    @Override
    public void getManufacturerSel(String macAddress, int type) {
        model.getManufacturerSel(macAddress, type,new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.onManufacturerSelSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });
    }

    @Override
    public void getModelSel(String macAddress, int type) {
        model.getModelSel(macAddress, type,new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.onModelSelSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });
    }
}